<?php
/** 
 * 
 *
 * @package api
 * @subpackage collections
 * @author $Author$
 * @version $Id: CompositeComparator.php 14 2006-11-28 22:05:19Z rdff3 $
 */
 
/**
 * @package api
 * @subpackage collections
 * @author $Author$
 * @version $Id: CompositeComparator.php 14 2006-11-28 22:05:19Z rdff3 $
 */
class CompositeComparator extends Object implements Comparator {
	private $major;
	private $minor;
	
	public function __construct( Comparator $major, Comparator $minor ) {
		$this->major = $major;
		$this->minor = $minor;
	}
	
	public function compare( Object $o1, Object $o2 ) {
		$result = $this->major->compare( $o1, $o2 );
		if ($result != 0)
			return $result;
		else
			return $this->minor->compare( $o1, $o2 );
	}
}

?>